package com.hyou.sc.feign.auth.module.user;

import java.io.Serializable;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import com.hyou.sc.feign.auth.dto.form.UserForm;
import com.hyou.sc.feign.auth.service.UserService;
import com.hyou.springboot.annotation.FormValidator;
import com.hyou.springboot.base.ResponseMessage;
import com.hyou.springboot.validator.group.AddGroup;

@RestController("userAddController")
public class UserAddController {
    
    private static final Logger log = LoggerFactory.getLogger(UserAddController.class);
    
    @Autowired
    private UserService userService;
    
    @FormValidator(AddGroup.class)
    @PostMapping(path = "/user/add", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public ResponseMessage<Serializable> add(@RequestBody UserForm form) {
        log.debug("param : form : {}", form);
        return userService.add(form);
    }
    
}
